package com.sinosoft.dsp.component.bpm.action;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlInputHidden;
import javax.faces.event.ActionEvent;

import com.sinosoft.dsp.component.bpm.exception.SinoBPMException;
import com.sinosoft.dsp.component.bpm.facade.engine.ProcessInstanceFacade;
import com.sinosoft.dsp.component.bpm.facade.engine.ProcessResourceFacade;
import com.sinosoft.dsp.component.bpm.util.JbpmConfig;
import com.sinosoft.dsp.component.bpm.viewbean.searchdata.IBpmInstanceSearchViewBean;
import com.sinosoft.dsp.platform.manager.ApplicationController;
import com.sinosoft.dsp.platform.utils.SinoManagedBean;
import com.sinosoft.dsp.system.core.log.Log;

/**
 * 平台查询行为类
 * 
 * @author 潘巍（PeterPan）
 * @since 2011-8-22 上午06:34:35
 * 
 */
@ManagedBean(name = "bpmSearchAction")
@RequestScoped
public class BpmSearchAction {

	private static final Log log = Log.getLog(BpmSearchAction.class.getName());

	@ManagedProperty(value = "#{applicationController}")
	private ApplicationController ac;

	@ManagedProperty(value = "#{processResourceFacade}")
	private ProcessResourceFacade prf;

	@ManagedProperty(value = "#{processInstanceFacade}")
	private ProcessInstanceFacade pif;

	public void search(ActionEvent actionEvent) throws SinoBPMException {
		UIComponent menu = actionEvent.getComponent();
		HtmlInputHidden hiddenInput = (HtmlInputHidden) menu.getChildren().get(
				0);
		// 获得参数
		String viewBeanId = (String) hiddenInput.getValue();

		IBpmInstanceSearchViewBean vb = SinoManagedBean.findBean(viewBeanId);
		
		JbpmConfig jbpmConfig = SinoManagedBean.findBean("jbpmConfig");
		//jbpmConfig.getExecutionService().createProcessInstanceQuery().p
	}

	public ApplicationController getAc() {
		return ac;
	}

	public void setAc(ApplicationController ac) {
		this.ac = ac;
	}

	public ProcessResourceFacade getPrf() {
		return prf;
	}

	public void setPrf(ProcessResourceFacade prf) {
		this.prf = prf;
	}

	public ProcessInstanceFacade getPif() {
		return pif;
	}

	public void setPif(ProcessInstanceFacade pif) {
		this.pif = pif;
	}

}
